﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace Spacer {
	public class TestActivity : Activity {
		public void Initialize() {

		}

		public void Paused() {

		}

		public void Resumed() {

		}

		public void Shutdown() {
		}
		
		public void Update() {
			if( !m_bFinished && Input.IsKeyDown(Keys.Escape) || Input.IsGamePadButtonDown(GamePadButton.Back) )
				m_bFinished = true;
		}

		public void DrawWorld() {
		}
		
		public void DrawOverlay() {
			float s, x, y, r, g, b;

			for(int i=0;i<5;i++) {
				s = 25.0f + 25.0f * Globals.Random;
				x = (Surface.Width - s) * Globals.Random;
				y = (Surface.Height - s) * Globals.Random;

				r = 1f * Globals.Random;
				g = 1f * Globals.Random;
				b = 1f * Globals.Random;

				Surface.DrawColor = new Color( r, g, b, 1.0f );
				Surface.DrawRect(
					new Vector2( x, y ),
					new Vector2( s, s ),
					Vector2.Zero,
					0f
				);
			}
		}

		public bool IsModal() {
			return true;
		}

		public bool IsTransparent() {
			return true;
		}

		public bool IsFinished() {
			return m_bFinished;
		}

		// ----------

		bool m_bFinished;
	}
}
